import React, {useEffect, useState} from 'react';
import {observer} from 'mobx-react';
import UserInfoStore from './store/UserInfoStore.js';

const Login = () => {
	return <div>
		<div>
			<label>用户名：
				<div><input type={'text'} value={UserInfoStore.username}
							onChange={e => UserInfoStore.username = e.target.value}/></div>
			</label>
			{UserInfoStore.username.length <= 0 ? <div>用户名为必填</div> : null}
		</div>
		<div>
			<label>密码：
				<div><input type={'password'} value={UserInfoStore.password} onChange={e => UserInfoStore.password = e.target.value}/>
				</div>
			</label>
			{UserInfoStore.password.length <= 0 ? <div>密码为必填</div> : null}
		</div>
		<button type={'button'} onClick={e => UserInfoStore.doLogin()}>登陆</button>
	</div>;
};

export default observer(Login);